//Thu Jul 14 22:26:38 IST 2011

#include <stdio.h>
#include <stdlib.h>

char ranking[] = "dfbcae";

int gt (char a, char b)
{
	int i;

	for (i=0; ranking[i]; i++)
		if (ranking [i] == a)
			return 1;
		else if (ranking [i] == b)
			return 0;
	abort();
}

int main()
{
	char input[] = "abcdeeabc";
	int i,j,k;

	for (i=0; input [i]; i++) {
		for (j=0; j < i; j++) {
			if (gt(input [i], input [j])) {
				k = input [j];
				input [j] = input [i];
				input [i]= k;
			}
		}
	}


	printf("Sorted output is : %s", input);
}

//Thu Jul 14 22:36:08 IST 2011 
//10 mins. hmm. too bad considering that i just implemented selection (or insertion ?) sort and not anything special
